import React, { useEffect, useState } from 'react'

export default function useMouse() {
    const [mouse, setMouse] = useState({x: 0, y: 0})

    useEffect(() => {
        const move = (e) => {
            setMouse({x: e.clientX < 20 ? e.clientX + 20 : e.clientX, y: e.clientY < 20 ? e.clientY + 20 : e.clientY})
        }
        window.addEventListener('mousemove',move)
     return () => {
        window.removeEventListener('mousemove', move)
     }
    },[])
  return mouse
}
